package org.gavin.service.impl;

import lombok.extern.slf4j.Slf4j;
import org.gavin.enums.RecommendEnums;
import org.gavin.service.AbsentLoaderService;
import org.springframework.stereotype.Service;

import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Function;

/**
 * AbsentLoader
 *
 * @author grl
 * @date 2024/1/30
 */
@Slf4j
@Service
public class AbsentLoaderImpl implements AbsentLoaderService {

    private AtomicInteger integer = new AtomicInteger(1);

    @Override
    public Function<RecommendEnums, String> incrementLoader() {
        return new Function<RecommendEnums, String>() {
            @Override
            public String apply(RecommendEnums keys) {
                log.error("-------------------------------");
                return String.valueOf(integer.getAndIncrement());
            }
        };
    }
}
